home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / gsdbloo.exe / DEMOE005.PAS < prev    next >
Pascal/Delphi Source File  |  1992-02-24  |  2KB  |  77 lines

  1. program DemoE005;
  2. {------------------------------------------------------------------------------
  3.                               DBase File Editor
  4.                               Expanded Sample 5
  5.                                  Demo Program
  6.  
  7.        Copyright (c)  Richard F. Griffin
  8.  
  9.        10 February 1992
  10.  
  11.        102 Molded Stone Pl
  12.        Warner Robins, GA  31088
  13.  
  14.        -------------------------------------------------------------
  15.        Use FieldUpdateScreen to display and edit all record fields
  16.        on-screen.  This example uses an index file.
  17.  
  18.        **********  Not For Use in a TurboVision Environment  **********
  19.  
  20.        If it does not already exist, the DEMOE5.DBF file will be created
  21.        by using the MakeTestData procedure in GS_GENF.PAS.
  22.  
  23.        All fields in the dBase record will be displayed on-screen using
  24.        the FieldUpdateScreen procedure in GS_dBFld_Objt.  All fields may
  25.        be edited and the record will be updated.  The memo record may also
  26.        be viewed and modified.
  27.  
  28.        Keys that may be used are:
  29.  
  30.             ESC    Exits
  31.             F10    Next Record
  32.             PgUp   Top of Record; Previous Record if Already at Top
  33.             PgDn   Bottom of Record; Next Record if at Bottom
  34.             Cursor Up, Down
  35.  
  36. -------------------------------------------------------------------------------}
  37.  
  38. uses
  39.    CRT,
  40.    DOS,
  41.    GS_KeyI,
  42.    GS_FileH,
  43.    GS_dBFld,
  44.    GS_dBase,
  45.    GS_GenF;
  46. var
  47.    MyFile  : GS_dBFld_Objt;
  48.    CkFile  : file;
  49.    NewFile : boolean;
  50.  
  51. begin
  52.    ClrScr;
  53.    if not GS_FileExists(CkFile,'DEMOE5.DBF') then
  54.    begin
  55.       writeln('Creating DEMOE5.DBF');
  56.       MakeTestData('DEMOE5', 20, true);
  57.       writeln('DEMOE5.DBF Created');
  58.       ClrScr;
  59.       NewFile := true;
  60.    end
  61.       else NewFile := false;
  62.    MyFile.Init('DEMOE5');
  63.    MyFile.Open;
  64.    if NewFile then MyFile.IndexTo('DEMOE5','LASTNAME');
  65.    MyFile.Index('DEMOE5');
  66.    MyFile.GetRec(Top_Record);
  67.    while (MyFile.FieldUpdateScreen) do
  68.    begin
  69.       if MyFile.RecChanged then MyFile.PutRec(MyFile.RecNumber);
  70.       if GS_KeyI_Chr = Kbd_PgUp then
  71.          MyFile.GetRec(Prev_Record)
  72.       else
  73.          MyFile.GetRec(Next_Record);
  74.    end;
  75.    MyFile.Close;
  76. end.
  77.